"""a='abcde'
print(a[:len(a)])
"""


import random , time
zidian=['drop','poem','wine','tick','person','cheerful','hard-working','patient']
zi=zidian[random.randint(0,8)]
print(f"你需要猜{len(zi)}位的单词")
ming=6*len(zi)
c=False
print(f"你还有{ming}此机会")
panduan1=[]
for i in range (0,len(zi)):
    panduan1.append(zi[i])
while ming>=1:
    n=0
    while n==0:
        caizi=input("你猜的字是：")
        if len(caizi)!=len(zi):
            print("位数不对，请重新猜过")
        else:
            n+=1
    n,a,b=0,0,0
    while n<len(caizi):
        if caizi[n] in panduan1:                #判断是否在列表里
                if caizi[n]==zi[n]:       #判断是否相对
                    a+=1                            #
                    if n<len(caizi):                #
                        print(caizi[n],end="")      #
                    if n==len(caizi):               #
                        print(caizi[n])             #
                
                else:
                    b+=1
                    if n<len(caizi):
                        print("_",end="")
                    if n==len(caizi):
                        print("_")
        else:
            if n<len(caizi):
                print("_",end="")
            if n==len(caizi):
                print("_")
        n+=1
    print(f"有{a}个字母在正确位置上,有{b}个字母是对的但位置是错的,还有{ming-1}次机会")
    if a==len(zi):
        c=True
        break
    ming-=1

if c:
    print("你赢了")
else:
    print("你输了")
        

#asdf
#adsa

    """
    n=0
    a=[]
    b=0
    while n==0:
        for i in range (0,len(zi)):
            if caizi(i) in panduan1:
                a.append(caizi(i))
                b+=1
        n+=1
    
    n=0
    while n==0:
        for i in a:
            if caizi.index(i)==zi.index(i):
                if caizi.index(i)<len(caizi):
                    print(i,end=" ")
                if caizi.index(i)==len(caizi):
                    print(i,end=" ")
            else:
                print("_")
            
    """
    """
    n1.append(n[z]+n[z+1])"""